using System;
using System.Collections.Generic;
using System.Text;
using System.Security.Principal;

namespace Com.AlbLab.GEP.Security
{
    public class MyIdentity : GenericIdentity
    {

        internal MyIdentity(string username, string password, string type)
            : base(username, type)
        {
            identityCreationDate = System.DateTime.Now;
            this.password = password;
            authenticated = true;
        }

        public MyIdentity(string username)
            : base(username)
        {
            identityCreationDate = System.DateTime.Now;
            authenticated = false;
        }

        public override bool IsAuthenticated
        {
            get
            {
                return authenticated;
            }
        }

        public string Password
        {
            get
            {
                return password;
            }
             set
            {
                password=value;
            }
        }

        public decimal UserID;
        private bool authenticated;
        private DateTime identityCreationDate;

        private string password;

        public DateTime IdentityCreationDate
        {
            get { return identityCreationDate; }
            set { identityCreationDate = value; }
        }

        public bool checkIdentity(string username, string password)
        {
            if (this.password != null && base.Name.Equals(username) && this.password.Equals(password)) return true;
            else return false;
        }
    }
}
